package com.gang.mars.annotation;

import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.stereotype.Component;

/**
 * @Author：gang.chen
 * @Date：2022/11/18 13:12
 */
//@Anno001(value = "米国")
//@Anno002("中国")
@Anno002(value = "中国")
public class AnnoTest {

    public static void main(String[] args) {
        Component annotation = AnnotationUtils.getAnnotation(AnnoTest.class, Component.class);

        String value = annotation.value();

        System.out.println(value);

        Component mergedAnnotation = AnnotatedElementUtils.getMergedAnnotation(AnnoTest.class, Component.class);

        String value1 = mergedAnnotation.value();

        System.out.println(value1);
    }

    void test1(){
        Anno001 annotation = AnnotationUtils.getAnnotation(AnnoTest.class, Anno001.class);
        String value = annotation.value();
        String location = annotation.location();
        System.out.println(value + ";" +location);

    }


}
